<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $this->display();
    }

    public function login(){

        $id=session('organ_id');
        if(session('organ_login') && $id){
           // $this->success('您已经登录！',U('Department/index'));
            $this->success('您已经登录！',U('Reporter/index'));
        }else{
            C('TOKEN_ON',false);
            $this->display();
        }
    }

    /**
     * 同步权限
     */
    /*public function syncAuth() {
        $reporter_list = M('UserInfo')->select();
        $channel_list = M('Channel')->select();
        foreach($reporter_list as $reporter) {
            foreach($channel_list as $channel) {
                $relation = $channel['relation'] ? unserialize($channel['relation']) : array();

                if(in_array($reporter['uid'], $relation[0])) {
                   echo M('UserPower')->data(array(
                        'user_id' => $reporter['uid'],
                        'channel_id' => $channel['chid'],
                        'org_id' => $channel['org_id'],
                    ))->add();
                }
            }
        }
    }*/
}